﻿package javase.socket.net;

//Demonstrate Sockets.
import java.net.*;
import java.io.*;

public class Whois {
	public static void main(String args[]) throws Exception {
		int c;
		Socket s = new Socket("internic.net", 43);
		InputStream in = s.getInputStream();
		OutputStream out = s.getOutputStream();
		String str = (args.length == 0 ? "www.sina.com" : args[0]) + "\n";
		byte buf[] = str.getBytes();
		out.write(buf);
		while ((c = in.read()) != -1) {
			System.out.print((char) c);
		}
		s.close();
	}
}
/*  Run result
Whois Server Version 1.3
Domain names in the .com, .net, and .org domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: OSBORNE.COM
Registrar: NETWORK SOLUTIONS, INC.
Whois Server: whois.networksolutions.com
Referral URL: www.networksolutions.com
Name Server: NS1.EPPG.COM
Name Server: NS2.EPPG.COM
Updated Date: 07-apr-2000
>>> Last update of whois database: Fri, 6 Oct 2000 10:03:36 EDT <<<
The Registry database contains ONLY .COM, .NET, .ORG, .EDU domains and
Registrars.
*/